# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-greenery
pkgname=('python2-greenery' 'python-greenery')
_pkgname=greenery
pkgver=4.2.2
pkgrel=1
pkgdesc='Greenery allows manipulation of regular expressions as finite state machines.'
arch=('any')
url='https://pypi.org/project/greenery/#files'
license=('APACHE')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('d989de2c553252640d0bf50c2a19bff28030e8460fd1f67d4f98554aa5d82d65a61f3718ac32050aa6604a7a9a3c8cf8991b8e0b78ee3bf919583d59341afaf0')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-greenery() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" -O1 --skip-build
}

package_python-greenery() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" -O1 --skip-build
}

